/*
 * NISTMessengerEMailFrame.java
 *
 * Created on December 10, 2003, 11:43 AM
 */

package gov.nist.applet.phone.ua.gui;

import gov.nist.applet.phone.ua.*;
/**
 *
 * @author  DERUELLE Jean
 */
public class NISTMessengerEMailFrame extends javax.swing.JFrame {
    
    /** Creates new form NISTMessengerEMailFrame */
    public NISTMessengerEMailFrame(MessengerManager sipMeetingManager,
                                String callee) {        
        this.sipMeetingManager=sipMeetingManager;
        this.callee=callee;
        initComponents();
        this.setSize(412, 381);  
        this.setResizable(false);        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        getContentPane().setLayout(null);

        setTitle("Write you email message");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        jPanel1.setLayout(null);

        jPanel1.setMinimumSize(new java.awt.Dimension(412, 381));
        jButton1.setText("Send your email");
        jButton1.setToolTipText("Click on this button to send the message");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel1.add(jButton1);
        jButton1.setBounds(140, 310, 130, 26);

        jTextArea1.setMinimumSize(new java.awt.Dimension(200, 200));
        jTextArea1.setPreferredSize(new java.awt.Dimension(200, 200));
        jPanel1.add(jTextArea1);
        jTextArea1.setBounds(30, 60, 350, 230);

        jLabel1.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel1.setText("You can write your email message below. ");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(30, 0, 290, 20);

        jLabel2.setText("The web address of the user-agent that can be used to contact");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(30, 20, 360, 20);

        jLabel3.setText("you back will be added to your message.");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(30, 40, 350, 20);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 412, 381);

        pack();
    }//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // Add your handling code here:
        this.sendMail();
        this.dispose();
    }//GEN-LAST:event_jButton1ActionPerformed
    
    private void sendMail(){
        this.sipMeetingManager.sendMessage(jTextArea1.getText(),callee);        
    }
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        //System.exit(0);
        this.dispose();
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        //new NISTMessengerEMailFrame().show();
    }
    
    private MessengerManager sipMeetingManager;
    private String callee;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
    
}
